-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add UrlFilter (WebFilter) #199
base: master
Are you sure you want to change the base?
Conversation
the CI is not happy : Missing BOM encoding for non-ASCII encoded file 'WebfilterUrlfilter.Tests.ps1' => you need to check the BOM of the file (use the same like other file) |
Process { | ||
|
||
$invokeParams = @{ } | ||
if ( $PsBoundParameters.ContainsKey('skip') ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not need skip for add ?
} | ||
|
||
if ( Get-FGTWebfilterUrlfilter -connection $connection @invokeParams -name $name ) { | ||
Throw "Already a URL profile object using the same name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a => an (URL)
|
||
Param( | ||
[Parameter (Mandatory = $false)] | ||
[string]$id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mandatory ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It takes the next ID available, so it doesn't need to be mandatory or specified
$_entry = new-Object -TypeName PSObject | ||
|
||
if ( $PsBoundParameters.ContainsKey('url_id') ) { | ||
$_entry | add-member -name "id" -membertype NoteProperty -Value $url_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo ? id => url_id ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id = ID of URL Filter profile
url_id = ID of URL inside that profile
So id =/= url_id
|
||
$urlfilter | add-member -name "name" -membertype NoteProperty -Value $name | ||
|
||
$urlfilter | add-member -name "id" -membertype NoteProperty -Value $id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this id ?
$_entry = new-Object -TypeName PSObject | ||
|
||
if ( $PsBoundParameters.ContainsKey('url_id') ) { | ||
$_entry | add-member -name "id" -membertype NoteProperty -Value $url_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here about id typo
|
||
$_urlfilter | add-member -name "entries" -membertype NoteProperty -Value $urlfilter.entries | ||
|
||
if ( $PsBoundParameters.ContainsKey('visibility') ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is always visibility ?
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'high')] | ||
Param( | ||
[Parameter (Mandatory = $true, ValueFromPipeline = $true, Position = 1)] | ||
#[ValidateScript({ Confirm-FGTWebfilterUrlfilter $_ })] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm...
|
||
} | ||
|
||
Describe "Add WebFilter UrlFilter" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing some add test
{ Add-FGTWebfilterUrlfilter -name $pester_url1 -url_id 1 -url_type simple -url powerfgt.com -action allow -status enable } | Should -Throw "Already a URL profile object using the same name" | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing Set and Remove test too
7b8256a
to
04852db
Compare
/azp run |
Commenter does not have sufficient privileges for PR 199 in repo FortiPower/PowerFGT |
No description provided.